/*
 * @Author: 陈俊升 761723995@qq.com
 * @Date: 2024-01-29 09:41:56
 * @LastEditors: 陈俊升 761723995@qq.com
 * @LastEditTime: 2024-01-29 09:57:31
 * @FilePath: /hr_new_vue3/src/apis/management/attendance/attendanceManagement/index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { ajaxService } from '@/utils/request';
// import * as Type from './type';
const env = import.meta.env;
const baseURL = 'http://192.168.31.128:30058';

/**
 * 获取考勤设定列表
 * @param params
 * @returns
 */
// 获取考勤设定列表
export function GetAttendanceSettingList(params: {
  name?: string;
  pageNumber?: number;
  pageSize?: number;
  typeName?: number[];
}) {
  const newParams = new URLSearchParams();
  if (params.name) newParams.append('name', params.name + '');
  newParams.append('pageNumber', params.pageNumber + '');
  newParams.append('pageSize', params.pageSize + '');
  params.typeName?.forEach((ele) => newParams.append('typeName', ele + ''));
  const queryString = newParams.toString();
  return ajaxService({
    url: `/hr/work_attendance/attendance_manage/attendance_setting/classes/list?${queryString}`,
    method: 'get',
    baseURL
  });
}

/**
 * 获取考勤设定列表
 * @param params
 * @returns
 */
// 获取考勤设定列表
export function PutAttendanceSettingList(data: {
  list: {
    /**
     * 适用部门 1 是 2否
     */
    applicableDepartment: number;
    /**
     * 适用人员 1 是 2否
     */
    applicableEmployee: number;
    /**
     * 打卡方案id
     */
    attendanceClockInId: number;
    /**
     * 考勤组id
     */
    attendanceTeamId: number;
    /**
     * 部门id
     */
    departmentId: number;
    /**
     * 类型 1正常打卡 2 豁免打卡
     */
    type: number;
    /**
     * 用户id
     */
    userId: number;
  }[];
}) {
  return ajaxService({
    url: `/hr/work_attendance/attendance_manage/attendance_setting/classes/update`,
    method: 'put',
    baseURL,
    data
  });
}
